#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

//快速幂公式
int mi(int a,int b, int c){
    int res = 1;
    while(b>0){
        if(b%2!=0){
            res = (res*a)%c;
        }
        long temp = a*a;
        a = (temp%c);
        b = b/2;
    }
    return res;
}

class Solution {
public:
    int cuttingRope(int n) {
       if(n<4){
           return n-1;
       }
       else if(n==4){
           return n;
       }
       long res =1;
       while(n>4){
           res *= 3;
           res%=t;
           n = n-3;
       }
       
       return int((res*n)%t);
    }
public:
    int t = 1000000007;
};

int main(){
    Solution S;
    cout<<S.cuttingRope(120)<<endl;
    
}